// import { nodeResolve } from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import { getBabelOutputPlugin } from '@rollup/plugin-babel';

const Global = `var process = {
  env: {
    NODE_ENV: 'production'
  }
};`

export default {
  input: 'src/index.js',
  output: {
    banner: Global,
    name: 'sman',
    file: './lib/sman.umd.js',
    format: 'umd',
    sourcemap: true
  },
  // output: [
  //   {
  //     file: 'lib/sman.umd.js',
  //     format: 'esm',
  //     plugins: [getBabelOutputPlugin({
  //       plugins:  ["@babel/plugin-transform-runtime"],
  //       presets: ['@babel/preset-env', {
  //         modules: 'umd'
  //       }]
  //     })]
  //   },
  //   {
  //     file: 'lib/sman.esm.js',
  //     format: 'esm',
  //   }
  // ],
  plugins: [
    // getBabelOutputPlugin({
    //   presets: ['@babel/preset-env']
    // }),
    json(),
    resolve({
      browser: true
    }),
    commonjs(),
    babel({
      babelHelpers: 'bundled',
      exclude: 'node_modules/**'
    })
  ],
};